<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<h1><i class="glyphicon glyphicon-user"></i> User <small>(User / peserta tes)</small></h1>
			<ol class="breadcrumb">
				<li><a href="<?php echo base_url(); ?>admin"><i class="glyphicon glyphicon-home"></i> Dashboard</a></li>
				<li class="active"><i class="glyphicon glyphicon-user"></i> User</li>
			</ol>
		</div>
	</div><!-- /.row -->
	
	<div class="row">
		<div class="col-lg-12">
			<h2>Daftar User <a  role="button" data-toggle="modal" data-target=".bs-baru-modal-sm" class="btn btn-success btn-sm"><i class="glyphicon glyphicon-plus"></i> Add a new</a></h2>
			<div class="table-responsive">
			<table class="table table-bordered table-hover table-striped tablesorter">
				<thead>
                  <tr>
                    <th>No</th>
                    <th>id <i class="glyphicon glyphicon-sort"></i></th>
                    <th>Username <i class="glyphicon glyphicon-sort"></i></th>
                    <th>Password <i class="glyphicon glyphicon-sort"></i></th>
                    <th width="155px">Actions</th>
                  </tr>
				</thead>
				<tbody>
                  <?php foreach($data as $row){ ?>
				  <tr>
                    <td><?php echo$no; ?></td>
                    <td><?php echo$row['id']; ?></td>
                    <td><?php echo$row['username']; ?></td>
                    <td><?php echo$row['password']; ?></td>
                    <td>
						<a class="btn btn-info btn-sm" data-toggle="modal" data-target=".bs-edit-<?php echo$row['id']; ?>-modal-sm"><i class="glyphicon glyphicon-pencil"></i> Edit</a>  
						<a href="<?php echo site_url('admin'); ?>/user/delete/<?php echo$row['id']; ?>" class="btn btn-danger btn-sm"><i class="glyphicon glyphicon-trash"></i> Delete</a>
					</td>
                  </tr>
				  <?php $no++; } ?>
				</tbody>
			</table>
			</div>
			
			<div class="pagination"><?php echo$this->pagination->create_links();?></div>
			
		</div>
	</div><!-- /.row -->
</div>

<!--baru-->
<div class="modal fade bs-baru-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
	<form action="<?php echo base_url(); ?>admin/user/simpan" method="post">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3 class="modal-title" id="myModalLabel"><b>Tambah User</b></h3>
      </div>
      <div class="modal-body">
		<div class="form-group">
			<label>Username</label>
			<input class="form-control" placeholder="Enter username" name="username">
		</div>
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-default" data-dismiss="modal"><i class="glyphicon glyphicon-floppy-remove"></i> Batal</button>
        <button type="submit" class="btn btn-warning" data-dismiss=".modal"><i class="glyphicon glyphicon-floppy-saved"></i> Simpan</button>
      </div>
    </form>
	</div>
  </div>
</div>

<?php foreach($data as $row){ ?>
<!--edit-->
<div class="modal fade bs-edit-<?php echo$row['id']; ?>-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
	<form action="<?php echo base_url(); ?>admin/user/ubah" method="post">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3 class="modal-title" id="myModalLabel"><b>Ubah User</b></h3>
      </div>
      <div class="modal-body">
		<div class="form-group">
			<label>Username</label>
			<input class="form-control" name="id" value="<?php echo$row['id']; ?>" type="hidden">
			<input class="form-control" placeholder="Enter username" name="username" value="<?php echo$row['username']; ?>">
		</div>
		<div class="form-group">
			<label>Password</label>
			<input class="form-control" placeholder="<?php echo$row['password']; ?>" name="password_baru" value="">
			<input class="form-control" placeholder="<?php echo$row['password']; ?>" name="password" value="<?php echo$row['password']; ?>" type="hidden">
		</div>
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-default" data-dismiss="modal"><i class="glyphicon glyphicon-floppy-remove"></i> Batal</button>
        <button type="submit" class="btn btn-warning" data-dismiss=".modal"><i class="glyphicon glyphicon-floppy-saved"></i> Simpan</button>
      </div>
    </form>
	</div>
  </div>
</div>
<?php } ?>